package zuoye.zy5;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class Test {
    public static void main(String[] args) {
//        创建四个List集合对象，分别用来存储3个玩家的牌以及底牌
        List<String> player1 = new ArrayList<>();
        List<String> player2 = new ArrayList<>();
        List<String> player3 = new ArrayList<>();
        List<String> dipai = new ArrayList<>();

        List<String> poker = new ArrayList<>();
        String[] colors = {"♠", "♥", "♣", "♦"};
        String[] numbers = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
//        遍历牌盒将合适的牌存储到上述指定的集合中
        for (String color : colors) {
            for (String number : numbers) {
                poker.add(color + number);
            }
        }
        poker.add("joker");
        poker.add("bigjoker");
        System.out.println(poker);
        Collections.shuffle(poker);
        for (int i = 0; i < poker.size() - 3; i++) {
            int chose = i % 3;
            switch (chose) {
                case 0:
                    player1.add(poker.get(i));
                    break;
                case 1:
                    player2.add(poker.get(i));
                    break;
                case 2:
                    player3.add(poker.get(i));
                    break;
            }
        }
        dipai.add(poker.get(51));
        dipai.add(poker.get(52));
        dipai.add(poker.get(53));
        System.out.println("玩家1：" + player1.toString());
        System.out.println("玩家2：" + player2.toString());
        System.out.println("玩家3：" + player3.toString());
        System.out.println("底牌：" + dipai.toString());
    }
//    排序
}

